package com.example.wangli.myservice;

import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MusicActivity extends AppCompatActivity {
  /*  private MediaPlayer player;
    private String mp3Path = "";
    private Boolean isPause = false;*/
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_music);
       /* Log.i("path",Environment.getExternalStorageDirectory().getAbsolutePath());*/
    }
    public void play(View v) throws Exception{
        common("play");
    }
    public void  pause(View v){
        common("pause");
    }
    public void common(String str){
        Intent intent = new Intent();
        intent.putExtra("action",str);
        intent.setAction("music");
        intent.setPackage(this.getPackageName());
        startService(intent);
    }
}
